export function checkLocationAuth() {
  wx.getSetting({
    success: (res) => {
      let authSetting = res.authSetting
      if (authSetting['scope.userLocation']) {
        // 已授权
        this.getLocation()
      } else if (authSetting['scope.userLocation'] === false) {
        wx.showModal({
          title: '您未开启地理位置授权',
          content: '请在系统设置中打开位置授权，以便我们为您提供更好的服务',
          success: (res) => {
            if (res.confirm) {
              wx.openSetting()
            }
          }
        })
      } else {
        wx.authorize({
          scope: 'scope.userLocation',
          success: () => {
            this.getLocation()
          },
          fail: () => {
            wx.showModal({
              title: '您未开启地理位置授权',
              content: '请在系统设置中打开位置授权，以便我们为您提供更好的服务',
              success: (res) => {
                if (res.confirm) {
                  wx.openSetting()
                }
              }
            })
          }
        })
      }
    }
  })
}